//index.js
//获取应用实例
var app = getApp()
const utils = require('../../utils/util');
Page({
  data: {
      yijinxing:"0",
      shengyu:365,
      modalday:0,
      modalHidden2:"",
      finishedWord:0,
      planStudyWordsOfDay: 0
  },

  onLoad: function (e) {
    console.log('onLoad')
    // wx.navigateTo({
    //     url: "../welcom/welcom"
    // })
    // var context=wx.createContext();
   //  context.setStrokeStyle("#25d416");
   //  context.setLineWidth(3);
   //  context.arc(100, 100, 60, 0.8* Math.PI, 1.4* Math.PI, false)
   //  // context.rect(0, 0, 200, 200);
   //  context.stroke();
   //  wx.drawCanvas({
   //   canvasId: 'dayscanvas',
   //   actions: context.getActions() //获取绘图动作数组
   // })
var that = this
setTimeout(function() {
    that.setData({
        modalHidden2:"true"
    });
}, 1000);


 },
 onShow: function() {
    var that = this;
    setTimeout(function() {
        let finishedWord = 0;
        let words = wx.getStorageSync(utils.wordBook);
        console.log('已完成===',words);
        if(words === null || words === undefined || words === '') {
          that.setData({finishedWord: 0});
        } else {
          that.setData({finishedWord: words.length});
        }
    }, 1000);

    var studiedDaystmp = wx.getStorageSync(utils.studiedDays);
    that.setData({
        modalday: Number.parseInt(studiedDaystmp)
    });

    // 获取计划完成天数
    var planDays = wx.getStorageSync(utils.planStudyDays);
    this.setData({shengyu: Number.parseInt(planDays)});
    // 获取今日待学
    var planStudyWordsOfDay = wx.getStorageSync(utils.planStudyWordsOfDay);
    this.setData({planStudyWordsOfDay: planStudyWordsOfDay});
    // 获取今日待复习
    var planReviewWordsOfDay = wx.getStorageSync(utils.planReviewWordsOfDay);
    this.setData({planReviewWordsOfDay: planReviewWordsOfDay});
 },
  gotoStudy: function() {
    var wordType = wx.getStorageSync(utils.wordType);
    console.log('study.js--->english_word.js',wordType);
    var course_num = wordType.course_num;
    var class_id = wordType.class_id;
      wx.navigateTo({
        url: '../english_word/english_word?course_num='+ course_num + '&class_id='+ class_id,
      })
  },
  gotoReview: function(){
      wx.navigateTo({
        url: '../wordlib/wordlib',
      });
  }
})
